Skip to content

Add OMP provider and model alias mapping#59

Open
cgrossde wants to merge 2 commits intogetagentseal:mainfrom
cgrossde:feat/omp-support-model-aliases
Open

Add OMP provider and model alias mapping#59
cgrossde wants to merge 2 commits intogetagentseal:mainfrom
cgrossde:feat/omp-support-model-aliases

Conversation

@cgrossde
Copy link
Copy Markdown

What this adds

OMP provider support

Oh My Pi stores sessions at ~/.omp/agent/sessions/ in the same JSONL format as Pi. This PR adds OMP as a first-class provider so its sessions are discovered and tracked automatically.

  • New omp provider reads from ~/.omp/agent/sessions/<sanitized-cwd>/*.jsonl
  • Shares all parsing logic with the existing Pi provider (same JSONL format, same tool names, same dedup strategy)
  • Sessions carry provider: 'omp' so the --provider omp filter works
  • Both providers remain independent — users running both Pi and OMP get separate entries in the dashboard

Model alias mapping

Proxies and self-hosted LLM gateways often rewrite model names before they reach the client. When a model name doesn't match any LiteLLM entry, calculateCost returns 0 and the session shows $0.00. There was no way to fix this without a codeburn release.

This PR adds a user-configurable alias map:

codeburn model-alias "my-proxy-model" "claude-opus-4-6"  # add
codeburn model-alias --list                               # list
codeburn model-alias --remove "my-proxy-model"            # remove

Aliases are stored in ~/.config/codeburn/config.json alongside the currency setting and applied at startup before any pricing lookup. User aliases take precedence over built-ins.

Built-in aliases ship for known proxy model name variants — specifically the anthropic--claude-4.6-opus double-dash dot-version format emitted by some Anthropic-compatible proxies — so common cases work out of the box without any configuration.

Resolution order: getCanonicalName strips structural noise first (pin suffixes, date stamps, provider/ slash prefixes), then resolveAlias maps the result to the canonical key used by LiteLLM and the fallback pricing table.

Files changed

  • src/providers/pi.ts — OMP provider factory and singleton; discoverSessionsInDir parameterized by provider name
  • src/providers/index.ts — OMP registered in core providers
  • src/models.tsBUILTIN_ALIASES, setModelAliases, resolveAlias; alias resolution wired into getModelCosts and getShortModelName
  • src/config.tsmodelAliases field added to CodeburnConfig
  • src/cli.tsmodel-alias command; setModelAliases called in preAction
  • README.md — OMP in provider table and requirements; new Model aliases section
  • tests/providers/omp.test.ts — new
  • tests/models.test.ts — new, covers builtin aliases, user aliases, override precedence, and existing model names

iamtoruk and others added 2 commits April 21, 2026 09:57
- Add OMP provider reading from ~/.omp/agent/sessions (same JSONL
  format as Pi, shared parser)
- Parameterize discoverSessionsInDir with provider name so sessions
  carry correct provider field
- Add BUILTIN_ALIASES for proxy model name variants (anthropic--claude-*
  double-dash format) that don't match LiteLLM keys
- Add model-alias CLI command for user-defined name mappings
- Wire setModelAliases into preAction after config load
- Add modelAliases field to CodeburnConfig
- Update README: OMP in provider table, model-alias section
…ories

OMP stores sub-agent JSONL files one level deeper than the project dir:
  ~/.omp/agent/sessions/<project>/<session-id>/<agent-name>.jsonl

The previous flat readdir scan only found files directly inside the
project dir, missing all sub-agent sessions entirely.

- Extract collectJsonlFromDir helper that recurses one level into
  subdirectories within each project dir
- Extend collectDiscoverySnapshot to also record mtime of sub-session
  subdirectories (adding files inside a subdir does not bump the parent
  dir mtime, so cache invalidation would otherwise never trigger)
- Add test covering sub-agent session discovery
@cgrossde cgrossde force-pushed the feat/omp-support-model-aliases branch from 0c5c6fa to 03c351c Compare April 21, 2026 08:28
@cgrossde
Copy link
Copy Markdown
Author

@iamtoruk If you find some time, please have a look. Let me know if you would like to see some changes or prefer not to merge this.

@iamtoruk
Copy link
Copy Markdown
Member

Hey Chris, thanks for this. The OMP provider and the model-alias work are both useful, and the tests are thorough. I wanted to land it cleanly today so I did the rebase work on our side and pushed a reconciled branch to our origin:

https://github.com/getagentseal/codeburn/tree/feat/omp-support-model-aliases

Since main moved quite a bit while this PR was open (PR #117 just merged, and we went through Node 22+ / node:sqlite changes) there were six conflict files to work through. I kept your OMP provider and alias feature as-is and applied a few small fixups on top that I want to flag:

  1. Prototype-pollution hardening in resolveAlias. The ?? chain let Object.prototype leak through when a model was literally named __proto__. Our existing prototype-pollution test suite caught it. Switched to Object.hasOwn checks.

  2. Dedup key and discovery cache now use source.provider. The PR's discoverSessionsInDir accepts providerName but three call sites were still using the literal 'pi': the dedup key prefix, saveDiscoveryCache, and parserVersion. OMP sources now prefix with omp: and land in their own cache namespace. Paths already discriminated so this wasn't a correctness bug, just cosmetics, but it keeps the cache and dedup semantics matching what we did for cursor-agent.

  3. Tiny cleanup. Combined the duplicated pi.js imports in providers/index.ts into one line, added a trailing newline to pi.ts.

Everything passes: 378 tests, cached-vs-uncached parity exact, and the codeburn model-alias flow works end-to-end.

One thing I need from you before I merge: the feature commit's author is set to AgentSeal <hello@agentseal.org>, which I think happened because our CLAUDE.md says "Commits from: AgentSeal". That guidance is for our own commits, not contributors. If you can rebase the commit with your own identity as author so you show up on the contributor graph, that would be great. One command on your end:

git commit --amend --author="Chris <2333584+cgrossde@users.noreply.github.com>" --no-edit
git push --force-with-lease

If that's awkward or you'd rather not, let me know and I'll merge from our branch instead and credit you in the CHANGELOG and merge commit message. Either way works for me.

Thanks again.

@github-actions
Copy link
Copy Markdown

firstlook

Signal Detail
Account Created 13y 7mo ago
Repos 62 public
Profile None provided ⚠️
History 28 merged, 15 rejected elsewhere
Merge quality 14 unique mergers, 8 repos with 100+ stars
Activity 4/12 months active
Followers 22
Signed Yes

Trusted (score: 79/100) -- Established contributor with a verified presence across GitHub.

Details
  • Self-merged: 4 | Externally merged: 24
  • Contributed to 8 repos with 100+ stars
  • This repo: First-time contributor

firstlook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants